fix: memory-leak-like issue in nv_trust attestation#132
Merged
Conversation
45ac66d to
327e6b6
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a memory-leak-like performance issue in the NVIDIA Trust attestation system by ensuring the attestation client and verifier are created only once instead of being recreated multiple times, which was causing exponential slowdown.
- Centralizes client creation in a new
get_client()function with@lru_cacheto ensure singleton behavior - Removes duplicate client configuration code from attester and verifier modules
- Consolidates shared functionality and constants into the
__init__.pymodule
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
packages/nilai-common/src/nilai_common/logger.py |
Removes unused default logger instance |
nilai-attestation/src/nilai_attestation/attestation/nvtrust/__init__.py |
Adds centralized client creation with caching and shared utilities |
nilai-attestation/src/nilai_attestation/attestation/nvtrust/nv_attester.py |
Refactors to use centralized client creation and removes duplicate code |
nilai-attestation/src/nilai_attestation/attestation/nvtrust/nv_verifier.py |
Updates to use centralized client creation and removes hardcoded name parameter |
nilai-attestation/src/nilai_attestation/app.py |
Adds logging configuration to suppress verbose SDK output |
nilai-attestation/src/nilai_attestation/attestation/nvtrust/__init__.py
Outdated
Show resolved
Hide resolved
nilai-attestation/src/nilai_attestation/attestation/nvtrust/__init__.py
Outdated
Show resolved
Hide resolved
nilai-attestation/src/nilai_attestation/attestation/nvtrust/nv_verifier.py
Show resolved
Hide resolved
327e6b6 to
9bde71e
Compare
blefo
approved these changes
Jul 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR changes the code to make sure the nv_trust only creates the client once and adds the verifier once. Otherwise, we cause the attester to be attached to a global instance and to be recreated multiple times. This makes the attestation to take exponentially more time, as more verifiers produce the attestation (though one is only produced).
The code is reorganized to ensure the client is only created once.